Blockchain-based data processing method and device

ABSTRACT

Techniques for processing blockchain data are described. A node in a blockchain network receives service data generated by a first service, wherein the service data comprises a data structure having a field a value of which indicates that the first service is associated with a first processing level. The node stores, based on the value of the field, the service data in a first data processing queue selected from a plurality of data processing queues, wherein the first data processing queue corresponds to the first processing level, and each of the plurality of data processing queues corresponds to a different processing level. The node generates a new block that stores the service data read from the first data processing queue, and additional service data read from one or more of the plurality of data processing queues.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of and claims the benefit of priorityof U.S. patent application Ser. No. 16/796,105, filed Feb. 20, 2020,which is a continuation of U.S. patent application Ser. No. 16/586,051,filed on Sep. 27, 2019, now U.S. Pat. No. 10,762,056, which is acontinuation of PCT Application No. PCT/CN2018/080501, filed on Mar. 26,2018, which claims priority to Chinese Patent Application No.201710190740.X, filed on Mar. 28, 2017, and each application is herebyincorporated by reference in its entirety.

TECHNICAL FIELD

The present application relates to the field of Internet informationprocessing technologies and the field of computer technologies, and inparticular, to a blockchain-based data processing method and device.

BACKGROUND

The blockchain technology is also referred to as a distributed ledgertechnology. As a distributed Internet database technology, theblockchain technology is characterized by decentralization,transparency, non-tampering, and trustworthiness. A network constructedbased on the blockchain technology can be referred to as a blockchainnetwork. The blockchain network includes a network node (which can alsobe referred to as a blockchain node). Each network node corresponds toat least one blockchain, and each blockchain includes at least oneblock.

When receiving data to be stored, the network node broadcasts the datato be stored to other network nodes in the blockchain network.Therefore, each network node in the blockchain network stores full dataof the blockchain network, and data stored on one network node isconsistent with that stored on another node.

Data is generally stored in the blockchain network in two stages: In afirst stage, the blockchain network receives data to be stored, andbroadcasts the data all over the blockchain network. As such, each nodein the blockchain network receives the data to be stored. In this case,each network node in the blockchain network writes the data to be storedin a cache. In a second stage, a network node in the blockchain networkthat obtains permission to store the data to be stored writes the datato be stored in a block when obtaining recording permission, and addsthe block to an existing blockchain. It can be seen that the data isstored in the blockchain network by using an asynchronous writingpolicy.

However, in an actual service scenario, when service data is stored in ablockchain network by using an asynchronous writing policy, generally, adata processing queue is maintained in a first stage, and data to bestored is sequentially written into the data processing queue based on atimestamp of the data to be stored. As such, in a second stage, data tobe stored in the data processing queue is written into a block based ona first in first out principle.

According to researches, in the previous method, there are followingproblems in storing data in the blockchain network: For services withrelatively high service priorities, service data processing efficiencyis relatively low, and consequently processing efficiency of theseservices is relatively low.

SUMMARY

In view of the above, implementations of the present application providea blockchain-based data processing method and device, to alleviate anexisting-technology issue of low efficiency of processing service dataof a service with a relatively high service priority.

An implementation of the present application provides a blockchain-baseddata processing method, including the following: obtaining, by a node ina blockchain network, at least one piece of service data generated in apredetermined time period, where the service data includes a processinglevel of a service that generates the service data; storing, by thenode, the service data in a data processing queue that matches theprocessing level; and separately reading, by the node, service data thatsatisfies a predetermined condition from different data processingqueues when a new block is generated, and storing the read service datain the block.

An implementation of the present application further provides ablockchain-based data processing device, including the following: anacquisition unit, configured to obtain at least one piece of servicedata generated in a predetermined time period, where the service dataincludes a processing level of a service that generates the servicedata; a storage unit, configured to store the service data in a dataprocessing queue that matches the processing level; and a processingunit, configured to separately read service data that satisfies apredetermined condition from different data processing queues when a newblock is generated, and store the read service data in the block.

At least one of the previously described technical solutions used in theimplementations of the present application can achieve the followingbeneficial effects:

Different service data is stored in different data processing queuesbased on processing levels, and a predetermined quantity of service datais read from the different data processing queues based a predeterminedcondition when storing data in a block, so that the service data withthe different processing levels can be processed, an existing-technologyrule of processing service data only based on time can be broken, and anexisting-technology issue of low efficiency of processing a service witha relatively high service priority can be alleviated. The solutionprovided in implementations of the present application not only ensuresefficiency of processing service data of a service with a high servicepriority, but also ensures efficiency of processing service data of aservice with a low service priority. When a service processing priorityis satisfied, the flexibility of processing service data in a blockchainis increased, and the use value of the blockchain in the serviceapplication field is also improved.

BRIEF DESCRIPTION OF DRAWINGS

The accompanying drawings described here are intended to provide afurther understanding of the present application, and constitute a partof the present application. The illustrative implementations of thepresent application and descriptions thereof are intended to describethe present application, and do not constitute limitations on thepresent application. In the accompanying drawings:

FIG. 1 is a flowchart illustrating a blockchain-based data processingmethod, according to an implementation of the present application;

FIG. 2(a) is a diagram illustrating a data processing queue thatcorresponds to service data with different processing levels, accordingto an implementation of the present application;

FIG. 2(b) is a diagram illustrating a data processing queue thatcorresponds to service data with different processing levels, accordingto an implementation of the present application;

FIG. 3 is a diagram illustrating a scenario of a blockchain-based dataprocessing method, according to an implementation of the presentapplication;

FIG. 4 is a diagram illustrating an example of a structure of ablockchain-based data processing device, according to an implementationof the present application; and

FIG. 5 is a flowchart illustrating an example of a computer-implementedmethod for processing blockchain data, according to an implementation ofthe present disclosure.

DESCRIPTION OF IMPLEMENTATIONS

To make the objectives, technical solutions, and advantages of thepresent application clearer, the following clearly and comprehensivelydescribes the technical solutions of the present application withreference to specific implementations and accompanying drawings of thepresent application. Apparently, the described implementations aremerely some rather than all of the implementations of the presentapplication. All other implementations obtained by a person of ordinaryskill in the art based on the implementations of the present applicationwithout creative efforts shall fall within the protection scope of thepresent application.

The technical solutions provided in the implementations of the presentapplication are described in detail below with reference to theaccompanying drawings.

FIG. 1 is a schematic flowchart illustrating a blockchain-based dataprocessing method, according to an implementation of the presentapplication. The method can be described as follows. The execution bodyin this implementation of the present application can be any servicenode (which can also be referred to as a blockchain node, and is simplyreferred to as a node below) in a blockchain network, and is not limitedhere. In this implementation of the present application, an example thatthe execution body is a node is used for description in detail.

Step 101: A node in the blockchain network obtains at least one piece ofservice data generated in a predetermined time period.

The service data includes a processing level of a service that generatesthe service data.

In this implementation of the present application, first, servicepriorities are determined for different services. Here, a servicepriority corresponds to a processing level of service data, that is, ahigher service priority indicates a higher processing level of theservice data generated for the service. Then, a field that represents aservice priority (or a processing level) of a service that service datais generated for is added to the service data. As such, after receivingthe service data, the node can determine the processing level of theservice data by using the field.

Usually, fields included in the service data include but are not limitedto a hash value, a version number, a public key, a signature, a hashvalue of a block that the service data belongs, a timestamp (that is, atime when the node processes the service data), etc. In this case, thefields included in the service data described in this implementation ofthe present application include but are not limited to those shown inTable 1. Some attributes of the fields are described in Table 1.

TABLE 1 Field Name Attribute Description Hash value Indicates a uniqueidentifier of each piece of service data Version Indicates a versionidentifier of a service data generation number mechanism Public keyIndicates a public key of a transaction initiation party SignatureIndicates the information obtained by a service initiation party bysigning with a private key, where if the signature is verified by apublic key, it indicates that the service is valid Service Indicates thespecific service information that corresponds information to the servicedata, such as a fund flow and a change of capital ownership, which iswritten by a transaction initiation party Hash of a Indicates the hashvalue of the block that the service data block that belongs if theservice data is included in a consensus; and the service indicates nullif the service data is not included in a data belongs consensus.Timestamp Indicates a time when the service data is processed by thenode (determined in precision of milliseconds) . . . . . .

Preferably, in this implementation of the present application, dataprocessing queues can be further configured for different servicepriorities based on determined service priorities. As such, whenreceiving the service data, the service data can be separately storedbased on service priorities.

In this implementation of the present application, service prioritiesdivided into a “high” service priority and a “low” service priority areused as an example for subsequent description. If service priorities aredivided into a “high” service priority and a “low” service priority,correspondingly, processing levels are also divided into a “high”processing level and a “low” processing level.

It is worthwhile to note that because there is a time interval betweentwo adjacent blocks in a blockchain, this time interval can be used as areference condition for setting a time period in this implementation ofthe present application. Implementations are not limited here.

Step 102: The node stores the service data in a data processing queuethat matches a processing level.

In this implementation of the present application, because differentdata processing queues can be created in advance based on servicepriorities of services (or processing levels of services), a mappingrelationship between a processing level and an identifier of a dataprocessing queue can be established in advance.

When receiving service data, the node extracts a processing level of theservice data (such extraction can include reading a processing levelfield in the service data and determining a processing level of theservice data based on the processing level field), determines a dataprocessing queue that corresponds to the processing level included inthe service data based on a pre-established mapping relationship betweena processing level and an identifier of a data processing queue, andstores the service data in the determined data processing queue.

FIG. 2(a) is a schematic diagram illustrating a data processing queuethat corresponds to service data with different processing levels,according to an implementation of the present application. It can beseen from FIG. 2(a) that two data processing queues are included. Onedata processing queue corresponds to a high processing level, that is,the service data stored in the data processing queue is generated for aservice with a high service priority (or a high service processinglevel). The other data processing queue corresponds to a low processinglevel, that is, the service data stored in the data processing queue isgenerated for a service with a low service priority (or a low serviceprocessing level).

It is worthwhile to note that service data stored in the data processingqueue can be arranged based on processing times of the service data, orcan be arranged based on service attributes included in the servicedata, or can be arranged based on a queue principle (a first in firstout principle). Implementations are not limited here.

Step 103: The node separately reads service data that satisfies apredetermined condition from different data processing queues when a newblock is generated, and stores the read service data in the block.

In this implementation of the present application, each node in theblockchain network processes service data in two stages. A first stagecan correspond to step 101 and step 102 in this implementation of thepresent application. A second stage can correspond to step 103 in thisimplementation of the present application, that is, storing the servicedata in the block. It is worthwhile to note that the solution describedin this implementation of the present application focuses on describingspecific service data that is read from different data processing queuesto be stored in a block, and therefore verification, consensus, etc. areomitted for simplicity in this implementation of the presentapplication. Such processing ways can be performed based on the existingtechnology.

Preferably, the predetermined condition described in this implementationof the present application can be determined based on a storage capacityof the block and a predetermined processing ratio of service data withdifferent processing levels, or can be determined in other ways,provided that it is ensured that the service data of the differentservice processing levels can be written evenly into the block.

The following describes in detail how the node separately reads theservice data that satisfies the predetermined condition from thedifferent data processing queues.

The node separately performs the following operations for the differentdata processing queues: determining a processing level that correspondsto a first data processing queue; if the processing level is a firstprocessing level, determining a predetermined processing ratio ofservice data with a second processing level, where the first processinglevel is higher than the second processing level; determining a firstprocessing quantity of service data with the first processing levelbased on the determined processing ratio and the storage capacity of theblock; and sequentially reading service data that satisfies the firstprocessing quantity from the first data processing queue based on thefirst processing quantity.

It is worthwhile to note that “first” and “second” included in the“first data processing queue” and “second data processing queue”described in this implementation of the present application have nospecial meanings and merely represent different data processing queues.

“first” and “second” included in the “first processing level” and“second processing level” described in this implementation of thepresent application have no special meanings and merely represent twodifferent processing levels. In this implementation of the presentapplication, assume that the first processing level is higher than thesecond processing level.

It is worthwhile to note that “first” and “second” included in the“first processing quantity” and “second processing quantity” describedin this implementation of the present application have no specialmeanings and merely represent different quantities.

The first data processing queue is used as a research object.

Step 1: Determine a processing level that corresponds to the first dataprocessing queue.

Step 2: Determine whether the processing level is the first processinglevel or the second processing level, if the processing level is thefirst processing level, perform step 3, and if the processing level isthe second processing level, perform step 4.

Step 3: Determine the predetermined processing ratio of the service datawith the second processing level, and determine the first processingquantity of the service data with the first processing level based onthe determined processing ratio and the storage capacity of the block;and sequentially read the service data that satisfies the firstprocessing quantity from the first data processing queue based on thefirst processing quantity.

Step 4: Determine the predetermined processing ratio of the service datawith the second processing level, and determine the second processingquantity of the service data with the second processing level based onthe determined processing ratio and the storage capacity of the block;and sequentially read the service data that satisfies the secondprocessing quantity from the first data processing queue based on thesecond processing quantity.

It is worthwhile to note that, in this implementation of the presentapplication, “the predetermined processing ratio of the service datawith the second processing level” can be understood as a minimum ratioof service data with a relatively low processing level in thisimplementation of the present application, that is, a ratio of acapacity occupied by a minimum quantity of service data with arelatively low processing level that needs to be stored relative to astorage capacity of a block when data is stored in the block this time.The processing ratio here can be adjusted based on actual demands.Implementations are not limited here.

Assume that the predetermined processing ratio of the service data withthe second processing level is p, the storage capacity (which can alsobe understood as an upper limit quantity of service data that can becarried by the block) of the block is x. In this case, it is determinedthat the first processing quantity of the service data with the firstprocessing level can be expressed as (1−p)×x, and the second processingquantity of the service data with the second processing level can beexpressed as px.

There is another case in this implementation of the present application,that is, a processing quantity of service data stored in the first dataprocessing queue is less than the first processing quantity, which meansthat after the first processing quantity is determined, the service datastored in the first data processing queue cannot satisfy the requirementof the first processing quantity. To implement proper use of resources,in this case, the service data is sequentially read from the first dataprocessing queue based on the processing quantity of the service datastored in the first data processing queue. That is, all the service datastored in the first data processing queue is read.

In this case, a processing quantity of service data is read from asecond data processing queue based on the processing quantity of theservice data stored in the first data processing queue and the storagecapacity of the block, and service data is sequentially read from thesecond data processing queue based on the determined processing quantityof the service data read from the second data processing queue.

The previous described expression is still used as an example here.Assume that the processing quantity of the service data stored in thefirst data processing queue is m. Because a value that corresponds to(1−p)×x is greater than m, the first processing quantity should be m. Assuch, the determined second processing quantity should be (x-m). Thatis, when a quantity of service data with a relatively high servicepriority is relatively small, it can be ensured that service data with arelatively high service priority can be preferentially processed, andservice data with a relatively low service priority can be processed asmuch as possible.

In this implementation of the present application, the sequentiallyreading service data that satisfies the first processing quantity fromthe first data processing queue includes the following: sequentiallyreading the service data that satisfies the first processing quantityfrom the first data processing queue based on order of a correspondingprocessing time of the service data.

Similarly, service data that satisfies the second processing quantitycan also be sequentially read from the second data processing queuebased on order of a corresponding processing time of the service data.

In this implementation of the present application, the storing the readservice data in the block includes the following: sequentially storingthe read service data in the block based on the order of thecorresponding processing time of the service data.

For example, FIG. 2(b) is a schematic diagram illustrating a dataprocessing queue that corresponds to service data with differentprocessing levels, according to an implementation of the presentapplication. It can be seen from FIG. 2(b) that different quantities ofservice data are sequentially read from the two data processing queuesin the way described in step 103.

Assume that a predetermined processing ratio of storing service datawith a relatively low processing level in a block is 30% each time, anda storage capacity of the block is 10, that is, 10 pieces of servicedata can be stored. Four pieces of service data are stored in a dataprocessing queue with a high processing level, and eight pieces ofservice data are stored in a data processing queue with a low processinglevel. It is determined that the processing amount of the service datawith the high processing level that needs to be selected is (1−30%)×10=7according to a system configuration policy. Apparently, 4 is less than7. Therefore, all the four pieces of service data stored in the dataprocessing queue with the high processing level are retrieved, and sixpieces of service data are retrieved from the data processing queue withthe low processing level. The 10 pieces of obtained service data arestored in the block based on the processing times of the service data.

Assume that a predetermined processing ratio of storing service datawith a relatively low processing level in a block is 30% each time, anda storage capacity of the block is 10, that is, 10 pieces of servicedata can be stored. Eight pieces of service data are stored in a dataprocessing queue with a high processing level, and eight pieces ofservice data are stored in a data processing queue with a low processinglevel. It is determined that the processing amount of the service datawith the high processing level that needs to be selected is (1−30%)×10=7according to a system configuration policy. Apparently, 8 is greaterthan 7. Therefore, seven pieces of service data are retrieved from thedata processing queue with the high processing level, and three piecesof service data are retrieved from the data processing queue with thelow processing level. The 10 pieces of obtained service data are storedin the block based on the processing times of the service data.

In this implementation of the present application, the node can alsoseparately reads the service data that satisfies the predeterminedcondition from the different data processing queues in the followingmethod: separately performing, by the node, the following operations forthe different data processing queues: determining a processing levelthat corresponds to a first data processing queue, and obtaining apredetermined processing ratio that corresponds to the processing level;and determining a processing quantity based on the determined processingratio and the storage capacity of the block, and sequentially readingservice data that satisfies the processing quantity from the first dataprocessing queue.

For each data processing queue, a processing level that corresponds tothe data processing queue is determined, and further a processing ratiothat corresponds to the data processing queue is determined based on apredetermined processing ratio that corresponds to a processing level. Aprocessing quantity is determined based on the determined processingratio and the storage capacity of the block, and service data thatsatisfies the processing quantity is sequentially read from the dataprocessing queue.

For example, n data processing queues are included, and the n dataprocessing queues correspond to n processing levels. Processing ratiosthat correspond to different processing levels can be represented bya_(i), that is, a processing ratio that corresponds to the firstprocessing level is a₁, a processing ratio that corresponds to an i^(th)processing level is a_(i), and a processing ratio that corresponds to ann^(th) processing level is a_(n), and (a₁+a₂+ . . . +a_(i)+ . . .a_(n))=1. For each data processing queue, if a storage capacity of ablock is X, a processing quantity that corresponds to the dataprocessing queue with the first processing level is a₁×X, a processingquantity that corresponds to the data processing queue with the i^(th)processing level is a_(i)×X, and a processing quantity that correspondsto the data processing queue with the n^(th) processing level isa_(n)×X.

According to the technical solution provided in this implementation ofthe present application, different service data is stored in differentdata processing queues based on processing levels, and a predeterminedquantity of service data is read from the different data processingqueues based a predetermined condition when storing data in a block, sothat the service data with the different processing levels can beprocessed, an existing-technology rule of processing service data onlybased on time can be broken, and an existing-technology issue of lowefficiency of processing a service with a relatively high servicepriority can be alleviated. The solution provided in implementations ofthe present application not only ensures efficiency of processingservice data of a service with a high service priority, but also ensuresefficiency of processing service data of a service with a low servicepriority. When a service processing priority is satisfied, theflexibility of processing service data in a blockchain is increased, andthe use value of the blockchain in the service application field is alsoimproved.

FIG. 3 is a diagram illustrating a scenario of a blockchain-based dataprocessing method, according to an implementation of the presentapplication. It can be seen from FIG. 3 that when receiving servicedata, a node in a blockchain network can select a data processing queuefor the service data based on a processing level of the service data,and write the service data into the data processing queue. When a newblock is generated, the node selects service data from different dataprocessing queues based on a service data selection policy (that is, theway described in step 103 in the previously described implementation),and stores the selected service data in the block.

Implementation 2

FIG. 4 is a schematic structural diagram illustrating a blockchain-baseddata processing device, according to an implementation of the presentapplication. The data processing device includes an acquisition unit401, a storage unit 402, and a processing unit 403.

The acquisition unit 401 is configured to obtain at least one piece ofservice data generated in a predetermined time period, where the servicedata includes a processing level of a service that generates the servicedata.

The storage unit 402 is configured to store the service data in a dataprocessing queue that matches the processing level.

The processing unit 403 is configured to separately read service datathat satisfies a predetermined condition from different data processingqueues when a new block is generated, and store the read service data inthe block.

In another implementation of the present application, the predeterminedcondition is determined based on a storage capacity of the block and apredetermined processing ratio of service data with different processinglevels.

In another implementation of the present application, the processingunit 403 separately reads service data that satisfies a predeterminedcondition from different data processing queues, including thefollowing: separately performing the following operations for thedifferent data processing queues: determining a processing level thatcorresponds to a first data processing queue; if the processing level isa first processing level, determining a predetermined processing ratioof service data with a second processing level, where the firstprocessing level is higher than the second processing level; determininga first processing quantity of service data with the first processinglevel based on the determined processing ratio and the storage capacityof the block; and sequentially reading service data that satisfies thefirst processing quantity from the first data processing queue based onthe first processing quantity.

In another implementation of the present application, the processingunit 403 sequentially reads service data that satisfies the firstprocessing quantity from the first data processing queue based on thefirst processing quantity, including the following: when a processingquantity of service data stored in the first data processing queue isless than the first processing quantity, sequentially reading servicedata from the first data processing queue based on the processingquantity of the service data stored in the first data processing queue.

In another implementation of the present application, the dataprocessing device further includes a determining unit 404.

The determining unit 404 determines a processing quantity of servicedata read from a second data processing queue based on the processingquantity of the service data stored in the first data processing queueand the storage capacity of the block; and sequentially reads servicedata from the second data processing queue based on the determinedprocessing quantity of the service data read from the second dataprocessing queue.

In another implementation of the present application, the processingunit 403 further determines the predetermined processing ratio of theservice data with the second processing level if the processing level isthe second processing level; determines a second processing quantity ofthe service data with the second processing level based on thedetermined processing ratio and the storage capacity of the block; andsequentially reads service data that satisfies the second processingquantity from the first data processing queue based on the secondprocessing quantity.

In another implementation of the present application, the processingunit 403 sequentially reads service data that satisfies the firstprocessing quantity from the first data processing queue, including thefollowing: sequentially reading the service data that satisfies thefirst processing quantity from the first data processing queue based onorder of a corresponding processing time of the service data.

In another implementation of the present application, the processingunit 403 stores the read service data in the block, including thefollowing: sequentially storing the read service data in the block basedon the order of the corresponding processing time of the service data.

In another implementation of the present application, the dataprocessing device further includes a creating unit 405.

The creating unit 405 creates different data processing queues inadvance based on processing levels of services.

The storage unit 402 stores the service data in a data processing queuethat matches the processing level, including the following: determiningthe data processing queue that corresponds to the processing levelincluded in the service data based on a mapping relationship between aprocessing level and a data processing queue; and storing the servicedata in the determined data processing queue.

In another implementation of the present application, the processingunit 403 separately reads service data that satisfies a predeterminedcondition from different data processing queues, including thefollowing: separately performing the following operations for thedifferent data processing queues: determining a processing level thatcorresponds to a first data processing queue, and obtaining apredetermined processing ratio that corresponds to the processing level;and determining a processing quantity based on the determined processingratio and the storage capacity of the block, and sequentially readingservice data that satisfies the processing quantity from the first dataprocessing queue.

It is worthwhile to note that, the data processing device provided inthis implementation of the present application can be implemented byusing software or hardware. Implementations are not limited here. Thedata processing device stores different service data in different dataprocessing queues based on processing levels, and reads a predeterminedquantity of service data from the different data processing queues baseda predetermined condition when storing data in a block, so that theservice data with the different processing levels can be processed, anexisting-technology rule of processing service data only based on timecan be broken, and an existing-technology issue of low efficiency ofprocessing a service with a relatively high service priority can bealleviated. The solution provided in implementations of the presentapplication not only ensures efficiency of processing service data of aservice with a high service priority, but also ensures efficiency ofprocessing service data of a service with a low service priority. When aservice processing priority is satisfied, the flexibility of processingservice data in a blockchain is increased, and the use value of theblockchain in the service application field is also improved.

In the 1990s, whether a technical improvement is a hardware improvement(for example, an improvement to a circuit structure, such as a diode, atransistor, or a switch) or a software improvement (an improvement to amethod procedure) can be clearly distinguished. However, as technologiesdevelop, current improvements to many method procedures can beconsidered as direct improvements to hardware circuit structures. Adesigner usually programs an improved method procedure into a hardwarecircuit, to obtain a corresponding hardware circuit structure.Therefore, a method procedure can be improved by using a hardware entitymodule. For example, a programmable logic device (PLD) (for example, afield programmable gate array (FPGA)) is such an integrated circuit, anda logical function of the PLD is determined by a user through deviceprogramming. The designer performs programming to “integrate” a digitalsystem to a PLD without requesting a chip manufacturer to design andproduce an application-specific integrated circuit chip. In addition, atpresent, instead of manually manufacturing an integrated circuit chip,such programming is mostly implemented by using “logic compiler”software. The logic compiler software is similar to a software compilerused to develop and write a program. Original code needs to be writtenin a particular programming language for compilation. The language isreferred to as a hardware description language (HDL). There are manyHDLs, such as Advanced Boolean Expression Language (ABEL), AlteraHardware Description Language (AHDL), Confluence, Cornell UniversityProgramming Language (CUPL), HDCal, Java Hardware Description Language(JHDL), Lava, Lola, MyHDL, PALASM, and Ruby Hardware DescriptionLanguage (RHDL). The very-high-speed integrated circuit hardwaredescription language (VHDL) and Verilog are most commonly used. A personskilled in the art should also understand that a hardware circuit thatimplements a logical method procedure can be readily obtained once themethod procedure is logically programmed by using the several describedhardware description languages and is programmed into an integratedcircuit.

A controller can be implemented by using any appropriate method. Forexample, the controller can be a microprocessor or a processor, or acomputer-readable medium that stores computer-readable program code(such as software or firmware) that can be executed by themicroprocessor or the processor, a logic gate, a switch, anapplication-specific integrated circuit (ASIC), a programmable logiccontroller, or a built-in microprocessor. Examples of the controllerinclude but are not limited to the following microprocessors: ARC 625D,Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. Thememory controller can also be implemented as a part of the control logicof the memory. A person skilled in the art also knows that, in additionto implementing the controller by using the computer-readable programcode, logic programming can be performed on method steps to allow thecontroller to implement the same function in forms of the logic gate,the switch, the application-specific integrated circuit, theprogrammable logic controller, and the built-in microcontroller.Therefore, the controller can be considered as a hardware component, andan apparatus configured to implement various functions in the controllercan also be considered as a structure in the hardware component. Or theapparatus configured to implement various functions can even beconsidered as both a software module implementing the method and astructure in the hardware component.

The system, apparatus, module, or unit illustrated in the previousimplementations can be implemented by using a computer chip or anentity, or can be implemented by using a product having a certainfunction. A typical implementation device is a computer. The computercan be, for example, a personal computer, a laptop computer, a cellularphone, a camera phone, a smartphone, a personal digital assistant, amedia player, a navigation device, an email device, a game console, atablet computer, or a wearable device, or a combination of any of thesedevices.

For ease of description, the apparatus above is described by dividingfunctions into various units. Certainly, when the present application isimplemented, a function of each unit can be implemented in one or morepieces of software and/or hardware.

A person skilled in the art should understand that an implementation ofthe present disclosure can be provided as a method, a system, or acomputer program product. Therefore, the present disclosure can use aform of hardware only implementations, software only implementations, orimplementations with a combination of software and hardware. Moreover,the present disclosure can use a form of a computer program product thatis implemented on one or more computer-usable storage media (includingbut not limited to a disk memory, a CD-ROM, an optical memory, etc.)that include computer-usable program code.

The present disclosure is described with reference to the flowchartsand/or block diagrams of the method, the device (system), and thecomputer program product based on the implementations of the presentdisclosure. It is worthwhile to note that computer program instructionscan be used to implement each process and/or each block in theflowcharts and/or the block diagrams and a combination of a processand/or a block in the flowcharts and/or the block diagrams. Thesecomputer program instructions can be provided for a general-purposecomputer, a dedicated computer, an embedded processor, or a processor ofanother programmable data processing device to generate a machine, sothat the instructions executed by the computer or the processor of theanother programmable data processing device generate an apparatus forimplementing a specific function in one or more processes in theflowcharts and/or in one or more blocks in the block diagrams.

These computer program instructions can be stored in a computer-readablememory that can instruct the computer or the another programmable dataprocessing device to work in a specific way, so that the instructionsstored in the computer-readable memory generate an artifact thatincludes an instruction apparatus. The instruction apparatus implementsa specific function in one or more processes in the flowcharts and/or inone or more blocks in the block diagrams.

These computer program instructions can be loaded onto the computer oranother programmable data processing device, so that a series ofoperations and steps are performed on the computer or the anotherprogrammable device, thereby generating computer-implemented processing.Therefore, the instructions executed on the computer or the anotherprogrammable device provide steps for implementing a specific functionin one or more processes in the flowcharts and/or in one or more blocksin the block diagrams.

In a typical configuration, a computing device includes one or moreprocessors (CPU), one or more input/output interfaces, one or morenetwork interfaces, and one or more memories.

The memory can include a non-persistent memory, a random access memory(RAM), a non-volatile memory, and/or another form that are in acomputer-readable medium, for example, a read-only memory (ROM) or aflash memory (flash RAM). The memory is an example of thecomputer-readable medium.

The computer-readable medium includes persistent, non-persistent,movable, and unmovable media that can store information by using anymethod or technology. The information can be a computer-readableinstruction, a data structure, a program module, or other data. Examplesof a computer storage medium include but are not limited to a parameterrandom access memory (PRAM), a static random access memory (SRAM), adynamic random access memory (DRAM), another type of random accessmemory (RAM), a read-only memory (ROM), an electrically erasableprogrammable read-only memory (EEPROM), a flash memory or another memorytechnology, a compact disc read-only memory (CD-ROM), a digitalversatile disc (DVD) or another optical storage, a cassette magnetictape, a magnetic tape/magnetic disk storage or another magnetic storagedevice. The computer storage medium can be used to store informationaccessible by the computing device. Based on the definition in thepresent specification, the computer-readable medium does not includetransitory computer-readable media (transitory media) such as amodulated data signal and carrier.

It is worthwhile to further note that, the terms “include”, “contain”,or their any other variants are intended to cover a non-exclusiveinclusion, so a process, a method, a product or a device that includes alist of elements not only includes those elements but also includesother elements which are not expressly listed, or further includeselements inherent to such a process, method, product or device. Withoutmore constraints, an element preceded by “includes a . . . ” does notpreclude the existence of additional identical elements in the process,method, product or device that includes the element.

The present application can be described in the general context ofcomputer executable instructions executed by a computer, for example, aprogram module. Generally, the program module includes a routine, aprogram, an object, a component, a data structure, etc. executing aspecific task or implementing a specific abstract data type. The presentapplication can also be practiced in distributed computing environments.In the distributed computing environments, tasks are performed by remoteprocessing devices connected through a communications network. In adistributed computing environment, the program module can be located inboth local and remote computer storage media including storage devices.

The implementations in the present specification are described in aprogressive way. For same or similar parts of the implementations,references can be made to the implementations. Each implementationfocuses on a difference from other implementations. Particularly, asystem implementation is basically similar to a method implementation,and therefore, is described briefly. For related parts, references canbe made to related descriptions in the method implementation.

The previous implementations are implementations of the presentapplication, and are not intended to limit the present application. Aperson skilled in the art can make various modifications and changes tothe present application. Any modification, equivalent replacement, orimprovement made without departing from the spirit and principle of thepresent application shall fall within the scope of the claims in thepresent application.

FIG. 5 is a flowchart illustrating an example of a computer-implementedprocess 500, according to an implementation of the present disclosure.For clarity of presentation, the description that follows generallydescribes the process 500 in the context of the other figures in thisdescription. However, it will be understood that the process 500 can beperformed, for example, by various combinations of systems,environments, software, and hardware, as described herein. In someimplementations, various steps of method 500 can be run in parallel, incombination, in loops, or in other orders.

At 502, service data generated by a first service is received by a nodein a blockchain network, wherein the service data includes a datastructure having a field a value of which indicates that the firstservice is associated with a first processing level. Fields included inthe data structure include but are not limited to a hash value, aversion number, a public key, a signature, a hash value of a block thatthe service data belongs, a timestamp (that is, a time when the nodeprocesses the service data), etc. In some implementations, a servicepriority corresponds to a processing level of service data, that is, ahigher service priority indicates a higher processing level of theservice data generated for the service. Then, a field that represents aservice priority (or a processing level) of a service is added to thedata structure of the service data. As such, after receiving the servicedata, the node can determine the processing level of the service data byusing the field. In some cases, service priorities for differentservices are determined, wherein a service priority corresponds to aprocessing level of service data generated by a corresponding service.As such, when receiving the service data, the service data can beseparately stored based on service priorities, which are determined byusing the field.

At 504, the service data in a first data processing queue selected froma plurality of data processing queues is stored by the node based on thevalue of the field, wherein the first data processing queue correspondsto the first processing level, and each of the plurality of dataprocessing queues corresponds to a different processing level. In somecases, the plurality of data processing queues are created in advancebased on the service priorities for different services generatingservice data to be stored. In some examples, stored service data isarranged in the first data processing queue based on processing times ofthe stored service data or based on service attributes included in thestored service data.

At 506, a new block that stores the service data read from the firstdata processing queue and additional service data read from one or moreof the plurality of data processing queues is generated by the node,wherein a quantity of service data read from each of the one or more ofthe plurality of data processing queues is determined in accordance witha condition for prioritizing storage of content from the plurality ofdata processing queues in the new block. In some cases, the conditionspecifies a fraction of a storage capacity of the new block that isallocated to each of the one or more of the plurality of data processingqueues. In some examples, the method includes determining, based on afirst fraction allocated to the first data processing queue, a firstquantity of service data to be read from the first data processingqueue, determining, based on a second fraction allocated to a seconddata processing queue of the plurality of data processing queues, asecond quantity of service data to be read from the second dataprocessing queue, and storing the first quantity of service data fromthe first data processing queue and the second quantity of service datafrom the second data processing queue in the new block. For example,assume that the first fraction allocated to the first data processingqueue is p, the second fraction allocated to the second data processingqueue is 1−p, and that the storage capacity of the new block is x, thenthe first quantity of service data is px and the second quantity ofservice data is (1−p)×x. In some implementations, the method includesdetermining that a total amount of service data stored in the first dataprocessing queue is less than the first quantity of service data,storing the total amount of service data from the first data processingqueue in the new block, and storing, in the new block, a third quantityof service data read from one or more of the plurality of dataprocessing queues, the third quantity representing a difference betweenthe first quantity and the total amount of service data stored in thefirst data processing queue. In some cases, at least a portion of thethird quantity of service data is read from the second data processingqueue. In some examples, storing the first quantity of service data fromthe first data processing queue includes reading the first quantity ofservice data from the first data processing queue based on an order ofcorresponding processing times of the service data, and storing thefirst quantity of service data in the new block based on the order ofcorresponding processing times of the service data.

Embodiments and the operations described in this specification can beimplemented in digital electronic circuitry, or in computer software,firmware, or hardware, including the structures disclosed in thisspecification or in combinations of one or more of them. The operationscan be implemented as operations performed by a data processingapparatus on data stored on one or more computer-readable storagedevices or received from other sources. A data processing apparatus,computer, or computing device may encompass apparatus, devices, andmachines for processing data, including by way of example a programmableprocessor, a computer, a system on a chip, or multiple ones, orcombinations, of the foregoing. The apparatus can include specialpurpose logic circuitry, for example, a central processing unit (CPU), afield programmable gate array (FPGA) or an application-specificintegrated circuit (ASIC). The apparatus can also include code thatcreates an execution environment for the computer program in question,for example, code that constitutes processor firmware, a protocol stack,a database management system, an operating system (for example anoperating system or a combination of operating systems), across-platform runtime environment, a virtual machine, or a combinationof one or more of them. The apparatus and execution environment canrealize various different computing model infrastructures, such as webservices, distributed computing and grid computing infrastructures.

A computer program (also known, for example, as a program, software,software application, software module, software unit, script, or code)can be written in any form of programming language, including compiledor interpreted languages, declarative or procedural languages, and itcan be deployed in any form, including as a stand-alone program or as amodule, component, subroutine, object, or other unit suitable for use ina computing environment. A program can be stored in a portion of a filethat holds other programs or data (for example, one or more scriptsstored in a markup language document), in a single file dedicated to theprogram in question, or in multiple coordinated files (for example,files that store one or more modules, sub-programs, or portions ofcode). A computer program can be executed on one computer or on multiplecomputers that are located at one site or distributed across multiplesites and interconnected by a communication network.

Processors for execution of a computer program include, by way ofexample, both general- and special-purpose microprocessors, and any oneor more processors of any kind of digital computer. Generally, aprocessor will receive instructions and data from a read-only memory ora random-access memory or both. The essential elements of a computer area processor for performing actions in accordance with instructions andone or more memory devices for storing instructions and data. Generally,a computer will also include, or be operatively coupled to receive datafrom or transfer data to, or both, one or more mass storage devices forstoring data. A computer can be embedded in another device, for example,a mobile device, a personal digital assistant (PDA), a game console, aGlobal Positioning System (GPS) receiver, or a portable storage device.Devices suitable for storing computer program instructions and datainclude non-volatile memory, media and memory devices, including, by wayof example, semiconductor memory devices, magnetic disks, andmagneto-optical disks. The processor and the memory can be supplementedby, or incorporated in, special-purpose logic circuitry.

Mobile devices can include handsets, user equipment (UE), mobiletelephones (for example, smartphones), tablets, wearable devices (forexample, smart watches and smart eyeglasses), implanted devices withinthe human body (for example, biosensors, cochlear implants), or othertypes of mobile devices. The mobile devices can communicate wirelessly(for example, using radio frequency (RF) signals) to variouscommunication networks (described below). The mobile devices can includesensors for determining characteristics of the mobile device's currentenvironment. The sensors can include cameras, microphones, proximitysensors, GPS sensors, motion sensors, accelerometers, ambient lightsensors, moisture sensors, gyroscopes, compasses, barometers,fingerprint sensors, facial recognition systems, RF sensors (forexample, Wi-Fi and cellular radios), thermal sensors, or other types ofsensors. For example, the cameras can include a forward- or rear-facingcamera with movable or fixed lenses, a flash, an image sensor, and animage processor. The camera can be a megapixel camera capable ofcapturing details for facial and/or iris recognition. The camera alongwith a data processor and authentication information stored in memory oraccessed remotely can form a facial recognition system. The facialrecognition system or one-or-more sensors, for example, microphones,motion sensors, accelerometers, GPS sensors, or RF sensors, can be usedfor user authentication.

To provide for interaction with a user, embodiments can be implementedon a computer having a display device and an input device, for example,a liquid crystal display (LCD) or organic light-emitting diode(OLED)/virtual-reality (VR)/augmented-reality (AR) display fordisplaying information to the user and a touchscreen, keyboard, and apointing device by which the user can provide input to the computer.Other kinds of devices can be used to provide for interaction with auser as well; for example, feedback provided to the user can be any formof sensory feedback, for example, visual feedback, auditory feedback, ortactile feedback; and input from the user can be received in any form,including acoustic, speech, or tactile input. In addition, a computercan interact with a user by sending documents to and receiving documentsfrom a device that is used by the user; for example, by sending webpages to a web browser on a user's client device in response to requestsreceived from the web browser.

Embodiments can be implemented using computing devices interconnected byany form or medium of wireline or wireless digital data communication(or combination thereof), for example, a communication network. Examplesof interconnected devices are a client and a server generally remotefrom each other that typically interact through a communication network.A client, for example, a mobile device, can carry out transactionsitself, with a server, or through a server, for example, performing buy,sell, pay, give, send, or loan transactions, or authorizing the same.Such transactions may be in real time such that an action and a responseare temporally proximate; for example an individual perceives the actionand the response occurring substantially simultaneously, the timedifference for a response following the individual's action is less than1 millisecond (ms) or less than 1 second (s), or the response is withoutintentional delay taking into account processing limitations of thesystem.

Examples of communication networks include a local area network (LAN), aradio access network (RAN), a metropolitan area network (MAN), and awide area network (WAN). The communication network can include all or aportion of the Internet, another communication network, or a combinationof communication networks. Information can be transmitted on thecommunication network according to various protocols and standards,including Long Term Evolution (LTE), 5G, IEEE 802, Internet Protocol(IP), or other protocols or combinations of protocols. The communicationnetwork can transmit voice, video, biometric, or authentication data, orother information between the connected computing devices.

Features described as separate implementations may be implemented, incombination, in a single implementation, while features described as asingle implementation may be implemented in multiple implementations,separately, or in any suitable sub-combination. Operations described andclaimed in a particular order should not be understood as requiring thatthe particular order, nor that all illustrated operations must beperformed (some operations can be optional). As appropriate,multitasking or parallel-processing (or a combination of multitaskingand parallel-processing) can be performed.

What is claimed is:
 1. A method, comprising: receiving, by a node in ablockchain network, service data generated by a first service, whereinthe service data comprises a data structure having a field a value ofwhich indicates that the first service is associated with a firstprocessing level; storing, by the node based on the value of the field,the service data in a first data processing queue selected from aplurality of data processing queues, wherein the first data processingqueue corresponds to the first processing level, and each of theplurality of data processing queues corresponds to a differentprocessing level; reading, by the node, a first quantity of service datafrom the first data processing queue based on an order of processingtimes of the service data in the first data processing queue; andgenerating, by the node, a new block that stores the first quantity ofservice data from the first data processing queue and additional servicedata read from one or more of the plurality of data processing queues,wherein a quantity of service data read from each of the one or more ofthe plurality of data processing queues is determined in accordance witha condition for prioritizing storage of content from the plurality ofdata processing queues in the new block.
 2. The method according toclaim 1, comprising: determining that a total amount of service datastored in the first data processing queue is less than the firstquantity of service data; storing the total amount of service data fromthe first data processing queue in the new block; and storing, in thenew block, a third quantity of service data read from one or more of theplurality of data processing queues, the third quantity representing adifference between the first quantity and the total amount of servicedata stored in the first data processing queue.
 3. The method accordingto claim 2, wherein at least a portion of the third quantity of servicedata is read from a second data processing queue.
 4. The methodaccording to claim 1, further comprising: determining service prioritiesfor different services, wherein a service priority corresponds to aprocessing level of service data generated by a corresponding service.5. The method according to claim 4, further comprising: creating theplurality of data processing queues in advance based on the servicepriorities for different services generating service data to be stored.6. The method according to claim 1, further comprising: arranging theservice data in the first data processing queue based on the processingtimes of the service data or based on service attributes comprised inthe service data.
 7. The method according to claim 1, wherein storingthe first quantity of service data from the first data processing queuecomprises: storing the first quantity of service data in the new blockbased on the order of processing times of the service data.
 8. Anon-transitory, computer-readable medium storing one or moreinstructions executable by a computer system to perform operations,comprising: receiving, by a node in a blockchain network, service datagenerated by a first service, wherein the service data comprises a datastructure having a field a value of which indicates that the firstservice is associated with a first processing level; storing, by thenode based on the value of the field, the service data in a first dataprocessing queue selected from a plurality of data processing queues,wherein the first data processing queue corresponds to the firstprocessing level, and each of the plurality of data processing queuescorresponds to a different processing level; reading, by the node, afirst quantity of service data from the first data processing queuebased on an order of processing times of the service data in the firstdata processing queue; and generating, by the node, a new block thatstores the first quantity of service data from the first data processingqueue and additional service data read from one or more of the pluralityof data processing queues, wherein a quantity of service data read fromeach of the one or more of the plurality of data processing queues isdetermined in accordance with a condition for prioritizing storage ofcontent from the plurality of data processing queues in the new block.9. The non-transitory, computer-readable medium according to claim 8,the operations comprising: determining that a total amount of servicedata stored in the first data processing queue is less than the firstquantity of service data; storing the total amount of service data fromthe first data processing queue in the new block; and storing, in thenew block, a third quantity of service data read from one or more of theplurality of data processing queues, the third quantity representing adifference between the first quantity and the total amount of servicedata stored in the first data processing queue.
 10. The non-transitory,computer-readable medium according to claim 9, wherein at least aportion of the third quantity of service data is read from a second dataprocessing queue.
 11. The non-transitory, computer-readable mediumaccording to claim 8, the operations comprising: determining servicepriorities for different services, wherein a service prioritycorresponds to a processing level of service data generated by acorresponding service.
 12. The non-transitory, computer-readable mediumaccording to claim 1, the operations comprising: creating the pluralityof data processing queues in advance based on the service priorities fordifferent services generating service data to be stored.
 13. Thenon-transitory, computer-readable medium according to claim 8, theoperations comprising: arranging the service data in the first dataprocessing queue based on the processing times of the service data orbased on service attributes comprised in the service data.
 14. Thenon-transitory, computer-readable medium according to claim 8, whereinstoring the first quantity of service data from the first dataprocessing queue comprises: storing the first quantity of service datain the new block based on the order of processing times of the servicedata.
 15. A system, comprising: one or more computers; and one or morecomputer memory devices interoperably coupled with the one or morecomputers and having tangible, non-transitory, machine-readable mediastoring one or more instructions that, when executed by the one or morecomputers, cause the one or more computers to perform one or moreoperations comprising: receiving, by a node in a blockchain network,service data generated by a first service, wherein the service datacomprises a data structure having a field a value of which indicatesthat the first service is associated with a first processing level;storing, by the node based on the value of the field, the service datain a first data processing queue selected from a plurality of dataprocessing queues, wherein the first data processing queue correspondsto the first processing level, and each of the plurality of dataprocessing queues corresponds to a different processing level; reading,by the node, a first quantity of service data from the first dataprocessing queue based on an order of processing times of the servicedata in the first data processing queue; and generating, by the node, anew block that stores the first quantity of service data from the firstdata processing queue and additional service data read from one or moreof the plurality of data processing queues, wherein a quantity ofservice data read from each of the one or more of the plurality of dataprocessing queues is determined in accordance with a condition forprioritizing storage of content from the plurality of data processingqueues in the new block.
 16. The system according to claim 15, theoperations comprising: determining that a total amount of service datastored in the first data processing queue is less than the firstquantity of service data; storing the total amount of service data fromthe first data processing queue in the new block; and storing, in thenew block, a third quantity of service data read from one or more of theplurality of data processing queues, the third quantity representing adifference between the first quantity and the total amount of servicedata stored in the first data processing queue.
 17. The system accordingto claim 16, wherein at least a portion of the third quantity of servicedata is read from a second data processing queue.
 18. The systemaccording to claim 15, the operations comprising: determining servicepriorities for different services, wherein a service prioritycorresponds to a processing level of service data generated by acorresponding service.
 19. The system according to claim 18, theoperations comprising: creating the plurality of data processing queuesin advance based on the service priorities for different servicesgenerating service data to be stored.
 20. The system according to claim15, the operations comprising: arranging the service data in the firstdata processing queue based on the processing times of the service dataor based on service attributes comprised in the service data.